package com.starbuzz;

/**
 * @author SnowmanAndBee
 * @version <version>
 * <description>
 * @date 2022/4/5 - 17:17
 */
public abstract class CaffeineBeverage {
    final void prepareRecipe() {
        boilWater();
        brew();
        pourInCup();
        addCondiments();
    }

    abstract void brew();

    abstract void addCondiments();

    void boilWater() {
        System.out.println("Boiling water");
    }

    void pourInCup() {
        System.out.println("Pouring into cup");
    }

    /**
     * 钩子，可用于控制算法流程，子类可选择复写
     */
    void hook(){}
}
